全部文档

9.3OPCUA命令管理

命令下发会指定某台OPCUA设备,并对此设备的指定属性进行异步读写。

9.3.1通过deviceId向挂载到网关的OPCUA设备下发异步命令

功能描述:异步向挂载到网关的OPCUA设备下发命令,读取/写入功能点属性信息。

POST /api/v1/commands/gateway/opcua/async

Body:

Name Type Description Required
deviceId int 设备ID Yes
functionType string 命令类型,可选值propertyGet/propertySet Yes
identifier string 属性名 Yes
identifierValue object 属性值,functionType值为propertySet时必需,值类型:String/Integer/Long/Float/Double/Boolean/Date/Bytes No

Body example:

{
    "deviceId":10086,
    "functionType": "propertySet",
    "identifier": "身高",
    "identifierValue": "180"
}
当功能属性类型为Bytes时,identifierValue由多个16进制字符和空格组成,空格无实际意义,例如:
"identifierValue": "13 0F 03"

cURL example:

curl --location --request POST '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/commands/gateway/opcua/async?accessKeyId={accessKeyId}&signatureNonce=495&signature={signature}' \
--header 'platform: 3' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
                "deviceId":10086,
                "functionType": "propertySet",
                "identifier": "身高",
                "identifierValue": "180"
            }'

Response data:

Name Type Description
commandId string 命令ID

Response example:

{
    "code":0,
    "message":null,
    "data":{
        "commandId": "02e86b96-a484-4e4e-9282-84b804f68fd5"
    }
}

9.3.2挂载到网关的OPCUA设备通过productId + deviceName异步下发读取/写入命令

功能描述:异步向挂载到网关的OPCUA设备下发命令,读取/写入功能点属性信息。

POST /api/v1/command/gateway/async/byname

Body:

Name Type Description Required
productId int 产品ID Yes
deviceName string 设备名称 Yes
functionType string 命令类型,可选值propertyGet/propertySet Yes
identifier string 属性名 Yes
identifierValue object 属性值,functionType值为propertySet时必需,值类型:String/Integer/Long/Float/Double/Boolean/Date/Bytes No

Body example:

{
    "productId":10086,
    "deviceName": "test",
    "functionType": "propertySet",
    "identifier": "身高",
    "identifierValue": "180"
}
当功能属性类型为Bytes时,identifierValue由多个16进制字符和空格组成,空格无实际意义,例如:
"identifierValue": "13 0F 03"

cURL example:

curl --location --request POST '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/command/gateway/async/byname?accessKeyId={accessKeyId}&signatureNonce=495&signature={signature}' \
--header 'platform: 3' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
                "productId":10086,
                "deviceName": "test",
                "functionType": "propertySet",
                "identifier": "身高",
                "identifierValue": "180"
            }'

Response data:

Name Type Description
commandId string 命令ID

Response

{
    "code":0,
    "message":"",
    "data":{
        "commandId": "02e86b96-a484-4e4e-9282-84b804f68fd5"
    }
}

results matching ""

    No results matching ""